package com.itheima.bos.web.action.base;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.itheima.bos.domain.base.Standard;
import com.itheima.bos.service.base.IStandardService;
import com.opensymphony.xwork2.ActionContext;

/**
 * 创建收派标准的action
 * @author yanju
 *
 */
@Namespace("/")
@ParentPackage("json-default")
@Scope("prototype")
@Controller
public class StandardAction {
	
	//定义service层的实现类属性
	@Autowired
	private IStandardService standardServicerImpl;
	
	//查询所有收派表标准的信息
	@Action(value="standard_findAll",results={@Result(name="success",type="json")})
	public String standard_findAll(){
		//得到查询到的数据
		List<Standard> list = standardServicerImpl.findAll();
		//将数据压入valueStack中返回到页面
		//System.out.println(list);
		ActionContext.getContext().getValueStack().push(list);
		return "success";
	}
}
